/*
 * @Author: hrg
 * @Date: 2024-01-27 17:29:45
 * @LastEditTime: 2024-01-27 17:37:10
 * @FilePath: \study_go\study08_gin\gin_demo_06\main\main.go
 * @Description:重定向
 */
package main

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

func main() {

	r := gin.New()

	r.GET("/index", func(c *gin.Context) {
		// 重定向
		// http.StatusMovedPermanently  代表301，含义是永久重定向
		c.Redirect(http.StatusMovedPermanently, "https://www.baidu.com")
	})

	r.Run(":9090")
}
